package com.rustic.server.dto;

import cn.hutool.core.bean.BeanUtil;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import com.rustic.server.po.Restaurant;
import com.rustic.server.dto.base.RestaurantBaseDTO;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;
import java.util.Date;

/**
 * 表[restaurant]对应UpdateDTO类
 *
 * @author auto
 */

@Data
@EqualsAndHashCode(callSuper = true)
public class RestaurantUpdateDTO extends RestaurantBaseDTO {
    /**
     * 自增ID
     */
//    @NotNull(message = "id不能为空")
//    @Min(value = 1, message = "id不能为空")
//    @ApiModelProperty(value = "自增ID", dataType = "Integer")
//    private Integer id;

    /**
     * 餐厅名称
     */
    @Length(min = 0, max = 100, message = "餐厅名称长度为0-100个字符")
    @ApiModelProperty(value = "餐厅名称", dataType = "String")
    private String name;

    /**
     * 餐厅地址
     */
    @Length(min = 0, max = 500, message = "餐厅地址长度为0-500个字符")
    @ApiModelProperty(value = "餐厅地址", dataType = "String")
    private String address;

    /**
     * 餐厅详细地址
     */
    @Length(min = 0, max = 500, message = "餐厅详细地址长度为0-500个字符")
    @ApiModelProperty(value = "餐厅详细地址", dataType = "String")
    private String detailedAddress;

    public Restaurant toRestaurant() {
        Restaurant restaurant = new Restaurant();
        BeanUtil.copyProperties(this, restaurant);
        return restaurant;
    }

}
